<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->id();
            $table->string('name')->comment('名称');
            $table->string('url')->comment('URL');
            $table->integer('cpm')->comment('千次展示收费（元）');
            $table->unsignedInteger('tire_id')->nullable()->comment('所属层级');
            $table->unsignedInteger('admin_user_id')->comment('所属管理员');
            $table->integer('initialization_read_num')->nullable()->comment('初始化阅读数');
            $table->integer('current_read_num')->nullable()->comment('当前阅读数');
            $table->integer('expect_read_num')->comment('期望阅读数');
            $table->tinyInteger('state')->default(0)->nullable()->comment('状态');
            $table->tinyInteger('speed_order')->default(0)->nullable()->comment('快单');
            $table->integer('pv')->nullable()->default(0)->comment('浏览数');
            $table->timestamp('opened_at')->nullable()->comment('开始时间');
            $table->timestamp('stopped_at')->nullable()->comment('结束时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('orders');
    }
}
